
const defaultState = {

    token:null,
    menus:[]
}



export default (state=defaultState,action:any)=>{

    console.log(action);

    const {type,data}=action;

    if(type==="OUT"){
 
        return defaultState;
       
    }

    if(type==="UPDATE_TOKEN"){

        const newState=JSON.parse(JSON.stringify(state));
        newState.token=data;
        return newState;
       
    }

    if(type==="UPDATE_MENUS"){

        const newState=JSON.parse(JSON.stringify(state));
        newState.menus=data;
        return newState;
       
    }

    
       return state;

}